import type { BasicColumn } from '/@/components/Table/src/types/table';
import type { FormProps } from '/@/components/Form';
// import { h } from 'vue';
// import { Tag } from 'ant-design-vue/lib/components';

export function getTeacherColumns(): BasicColumn[] {
  return [
    {
      title: '工号',
      width: 150,
      dataIndex: 'teacherNo',
    },
    {
      title: '姓名',
      dataIndex: 'name',
      width: 150,
    },
    {
      title: '手机号',
      dataIndex: 'teacherPhone',
      width: 150,
    },
    {
      title: '资历',
      dataIndex: 'career',
      width: 150,
    },
    {
      title: '级别',
      dataIndex: 'level',
      width: 100,
      customRender: ({ record: { level } }) => {
        const levelJson = {
          '1': '高级讲师',
          '2': '首席讲师',
        };
        return levelJson[level];
        //   return h(Tag, null, () => levelJson[level]);
      },
    },
    {
      title: '加入时间',
      width: 150,
      sorter: true,
      dataIndex: 'gmtCreate',
    },
  ];
}
export function getSearchFormConfig(): Partial<FormProps> {
  return {
    labelWidth: 70,
    autoSubmitOnEnter: true,
    schemas: [
      {
        field: 'name',
        label: '姓名',
        component: 'Input',
        colProps: {
          xl: 4,
          xxl: 8,
        },
      },
      {
        field: 'level',
        label: '级别',
        component: 'Select',
        colProps: {
          xl: 4,
          xxl: 8,
        },
        componentProps: {
          options: [
            {
              label: '高级讲师',
              value: 1,
              key: '1',
            },
            {
              label: '首席讲师',
              value: 2,
              key: '2',
            },
          ],
        },
      },
      {
        field: '[startTime, endTime]',
        label: '时间范围',
        component: 'RangePicker',
        componentProps: {
          format: 'YYYY-MM-DD HH:mm:ss',
          placeholder: ['开始时间', '结束时间'],
          showTime: { format: 'HH:mm:ss' },
        },
        colProps: {
          xl: 8,
          xxl: 8,
        },
      },
    ],
  };
}
